﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    class Hello
    {
        public void Click(object send, EventArgs e)
        {
            Form f = (Form)send;
            f.Text = Cursor.Position.X.ToString() + ":" + Cursor.Position.Y.ToString();
        }

        public void Paint(object send, PaintEventArgs e)
        {
            Form f = (Form)send;
            Graphics g = e.Graphics;
            g.Clear(Color.Black);
            g.DrawString("Hello world!", f.Font, Brushes.White, new Point(20, 20));
        }
    }
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Hello h = new Hello();
            Form f = new Form();
            f.Paint += new PaintEventHandler(h.Paint);
            f.Click += new System.EventHandler(h.Click);
            Application.Run(f);
        }
    }
}
